﻿// Decompiled with JetBrains decompiler
// Type: Netick.LocalInterpolation
// Assembly: Netick, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6726ECA1-C773-4CF7-8952-E81B30D93B52
// Assembly location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.dll
// XML documentation location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.xml

#nullable disable
namespace Netick;

/// <summary>
/// A class representing the local interpolation of this instance <see cref="T:Netick.NetickEngine" />. This should be used whenever you want to use Predicted Timeline on the client.
/// </summary>
public sealed class LocalInterpolation : Interpolation
{
  public override Tick From => this.Engine.Tick - 1;

  public override Tick To => this.Engine.Tick;

  public override float Alpha => this.Engine._timer.Alpha;

  public override bool HasSnapshots => true;

  /// <summary>Time in seconds.</summary>
  public override float Time
  {
    get
    {
      return (float) this.Engine.PredictedTick.Value * this.Engine.FixedDeltaTime + (float) this.Engine._timer.Accumulator;
    }
  }

  public LocalInterpolation(NetickEngine engine)
    : base(engine)
  {
    this.FromSnapshot = this.Engine._sim.From;
    this.ToSnapshot = this.Engine._sim.To;
  }

  internal void Update()
  {
    this.FromSnapshot = this.Engine._sim.From;
    this.ToSnapshot = this.Engine._sim.To;
  }
}
